#!/bin/sh
PATH=/sbin:/bin:/usr/bin:/usr/sbin:%OPTWARE_TARGET_PREFIX%/bin:%OPTWARE_TARGET_PREFIX%/sbin

start() {
	set backup=$HOME
	echo "Starting amuled..."
	echo "Configuration's setting are located in %OPTWARE_TARGET_PREFIX%/share/amule"
	export HOME=%OPTWARE_TARGET_PREFIX%/share/amule
	%OPTWARE_TARGET_PREFIX%/bin/amuled -f
	export HOME=$backup
	echo "done"
}

stop() {
	echo -n "Shutting down amuled... "
	killall amuled
	killall amuleweb
	echo "done"
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		sleep 1
		start
		;;
	*)
		echo "Usage: $0 (start|stop|restart)"
		exit 1
		;;
esac
